package com.base.sms.config;

import com.base.core.codec.Md5Utils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.security.GeneralSecurityException;

@Component
@ConfigurationProperties(prefix = "sms.aixun")
public class AixunConfig implements Serializable {

    private String url;

    private String username;

    private String password;

    private String signName;

    private String template;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPassword() throws GeneralSecurityException {
        return Md5Utils.md5(username + Md5Utils.md5(password));
    }

    public String getUsername() {
        return username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getSignName() {
        return signName;
    }

    public String getTemplate() {
        return template;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    public void setTemplate(String template) {
        this.template = template;
    }
}
